{#{% load mytags %}#}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    {% include 'link_css.html' %}
    {% include 'head_script.html' %}
</head>
<body>
<div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
    </section>

    <!-- Main content -->

    <section class="content">

      <!-- Default box -->
      <div class="box">

        <div class="box-body">
{#        {% for d in line %}#}
{#        <p>{{ d|res_splict|safe }}</p><br>#}
{#        {% endfor %}#}
{#        {% if line %}#}
{#            {% for d in line %}#}
{#            {{ d }}<br>#}
{#            {% endfor %}#}
{#        {% else %}#}
{#            <i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>#}
{#            <span class="sr-only">Loading...</span>#}
{#        {% endif %}#}
        <div id="log_ret">
{#            {% if project.status == False %}#}
        </div>
        <div id="loading">
            <i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>
            <span class="sr-only">Loading...</span>
{#            {% endif %}#}
{#            {% if project.status == True %}#}
{#                <div id="loading" style="display: block">#}
{#                    <i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i>#}
{#                    <span class="sr-only">Loading...</span>#}
{#                </div>#}
{#            {% endif %}#}
        </div>
        <!-- /.box-body -->
        <div class="box-footer">
          <i class="fa fa-info-circle"></i>
        </div>
        <!-- /.box-footer-->
      </div>
      <!-- /.box -->
</div>
    </section>

  </div>
</body>
<script>
    var v1 = window.setInterval("status()",2000);

    function status() {
            $.get("/delivery/log2/{{ project_id }}/",function(data){
                document.getElementById("log_ret").innerHTML = data;
                //滚动条自动向下滑动
                $(function(){
                      var h = $(document).height()-$(window).height();
                      $(document).scrollTop(h);
                });
            });

            $.get("/delivery/status/{{ project_id }}/",function(data){
                var ret = JSON.parse(data);
                if (ret.status == false) {
{#                    var obj = document.getElementById("loading");#}
{#                    obj.style.display = "none";#}
                    // stop the v1 timer 停用计时器以减少查询
                    window.clearInterval(v1);
                    //document.getElementById("loading").innerHTML = "<h4>project {{ project.job_name }}  {{ project.deploy_num }}th times deploy finished!</h4>";
                    document.getElementById("loading").innerHTML = "<hr>";

                }

            });
    }
</script>
</html>


